<template>
	<view class="indexdiv">
	<view>
		<view><image class="bg-img" src="../../static/index/img3.jpg"></image></view>
	</view>
	<view>
		<Headtitle></Headtitle>
	</view>
    <view>
		<Round></Round>
	</view>
	<view>
		<Menu></Menu>
	</view>
	<view>
		<Title></Title>
	</view>
	<view>
		<College></College>
	</view>
	</view>
</template>

<script>
	import Headtitle from '/pages/index/TedentSon/Headtitle.vue'
	import Round from '/pages/index/TedentSon/Round.vue'
	import Menu from '/pages/index/TedentSon/Menu.vue'
	import Title from '/pages/index/TedentSon/Title.vue'
	import College from '/pages/index/TedentSon/College.vue'
	export default {
		components: {
			Headtitle,
			Round,
			Menu,
			Title,
			College
		},
		data() {
			return {
				islogin: ''
			}
		},
		onLoad() {
			this.studentNum = wx.getStorageSync('studentnum');
			this.studentClass = wx.getStorageSync('studentclass');
			this.StudentName = wx.getStorageSync('myname');
			this.token = wx.getStorageSync('token');
			this.openid = wx.getStorageSync('openid');
			if (this.token || this.openid) {
				this.islogin = true
				this.getClass()
				this.getName()
			} else {
				this.islogin = false
			}
			
		},
		methods:{
			getClass() {
				uni.request({
					url: 'https://backendth.flymi.top/student?keyword=' + this.studentNum,
					method: 'GET',
					data: {},
					success: res => {
						this.Class = res.data.data;
						this.Class.forEach((item) => {
							this.classname = item.classInfo.className
						})
						uni.setStorage({
							key: 'studentclass',
							data: this.classname,
						});
					},
					fail: () => {},
					complete: () => {}
				});
			},
			getName() {
				uni.request({
					url: 'https://backendth.flymi.top/student?keyword=' + this.studentNum,
					method: 'GET',
					data: {},
					success: res => {
						this.Name = res.data.data;
						this.Name.forEach((item) => {
							this.studentname = item.studentInfo.studentName
						})
						uni.setStorage({
							key: 'myname',
							data: this.studentname,
						});
					},
					fail: () => {},
					complete: () => {}
				});
			},
		}
	}
</script>

<style>
.bg-img {
		position: fixed;
		width: 100%;
		height: 100%;
		top: 0;
		left: 0;
		z-index: -1;
	}
.indexdiv{
	margin: 5px;
}
</style>
